package com.androidcentralmedias;


import java.io.OutputStreamWriter;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MudarIp extends Activity {
	public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.ip);
        final Button salvar1Button = (Button) findViewById(R.id.salvar1);
        final EditText ip1 = (EditText) findViewById(R.id.ip1);
        final TextView ip1text = (TextView) findViewById(R.id.ip1text);
        ip1text.setText(Client.ip1);
        salvar1Button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	ip1text.setText(ip1.getText());
            	Client.ip1 = ip1.getText().toString();
            	try {
            		  // open myfilename.txt for writing
            		  OutputStreamWriter out = new OutputStreamWriter(openFileOutput("ip1.txt",0));
            		  // write the contents on mySettings to the file 
            		  out.write(ip1.getText().toString());
            		  // close the file
            		  out.close();
            		} catch (java.io.IOException e) {
            		}
            	}});
    }

}